//
//  TCLYCommentTableViewCell.m
//  YuErmuYing
//
//  Created by LYang on 16/9/3.
//  Copyright © 2016年 Tiancheng. All rights reserved.
//

#import "TCLYCommentTableViewCell.h"
#import "Macros.h"
#import "Masonry.h"

@implementation TCLYCommentTableViewCell
-(instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = bgColor;
        UIImageView * bgImageView = [[UIImageView alloc] init];
        bgImageView.backgroundColor = [UIColor whiteColor];
        [self addSubview:bgImageView];
        [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(6);
            make.left.mas_equalTo(self);
            make.right.mas_equalTo(self);
            make.bottom.mas_equalTo(-6);
        }];
        //头像
        self.headerImageView = [[UIImageView alloc] init];
        self.headerImageView.layer.cornerRadius = 15;
        self.headerImageView.layer.masksToBounds = YES;
        [self addSubview:self.headerImageView];
        [self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.mas_left).offset(12);
            make.top.mas_equalTo(self.mas_top).offset(12);
            make.width.mas_equalTo(30);
            make.height.mas_equalTo(30);
        }];
        //昵称
        self.nickNameLabel = [[UILabel alloc] init];
        self.nickNameLabel.font = [UIFont systemFontOfSize:12];
        self.nickNameLabel.textColor = blackFont;
        self.nickNameLabel.textAlignment = NSTextAlignmentLeft;
        [self addSubview:self.nickNameLabel];
        [self.nickNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self.headerImageView);
            make.left.mas_equalTo(self.headerImageView.mas_right).offset(12);
            make.right.mas_equalTo(self.mas_right).offset(-12);
            make.height.mas_equalTo(20);
        }];
        
        //内容
        self.commentLabel = [[UILabel alloc] init];
        self.commentLabel.font = [UIFont systemFontOfSize:12];
        self.commentLabel.textColor = grayFont;
        self.commentLabel.textAlignment = NSTextAlignmentLeft;
        self.commentLabel.numberOfLines = 0;
        [self addSubview:self.commentLabel];
        
        //显示赞同的label
        self.timeLabel =[[UILabel alloc] init];
        self.timeLabel.font = [UIFont systemFontOfSize:10];
        self.timeLabel.textColor = [UIColor lightGrayColor];
        [self addSubview:self.timeLabel];
//        [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.mas_equalTo(self.commentLabel);
//            make.top.mas_equalTo(self.commentLabel.mas_bottom).offset(6);
//            make.width.mas_equalTo(80);
//            make.height.mas_equalTo(20);
//        }];
    }
    return self;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
